﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace jQWidgetsMVCDemo.Controllers
{
	public class WidgetsController : Controller
	{
		// GET: /Widgets//Store
		public ActionResult Store()
		{
			var shirt = Request.Form["shirt"];
			if (shirt != null)
			{
				string price = "0.00";
				switch (shirt)
				{
					case "Brown":
					price = "5.00";
					break;
					case "Red":
					price = "6.00";
					break;
					case "Green":
					price = "7.75";
					break;
					case "Black":
					price = "8.25";
					break;
					case "White":
					price = "9.50";
					break;
				}
				return Json(price, JsonRequestBehavior.AllowGet);
			}

			ViewData["Color"] = Request.Form["shirtDropdownList"];
			ViewData["Size"] = Request.Form["shirtDropDownListSize"];
			ViewData["Price"] = Request.Form["priceInput"];

			return View();
		}

		public ActionResult DropDownList()
		{
			return View("DropDownList");
		}
	}
}